use std::env;
use std::fs;

fn file() {
    let filename = "hello.txt";
    println!("In file: {}", filename);

    let contents = fs::read_to_string(filename).expect("unable to read");
    println!("contents are: {}", contents);
}

fn main() {
    let args: Vec<String> = env::args().collect();

    println!("Hello, world args: {:?}!", args);

    // 通过len判断长度
    println!("args count: {:?}", args.len());
    if (args.len() > 2) {
        println!("2nd args is : {:?}", args[1]);
    }
    file();
}
